#include "GLSceneInterfaceDrawers.h"

namespace catan
{

/*static*/ void GLSceneInterfaceDrawers::drawButton(float left, float right, float bottom, float top, GLuint texture, SDLCanvas &sdlCanvas)
{
	GLint oldTexture;
	glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTexture);
	float newLeft = left * sdlCanvas.getClientUnitWidth();
	float newRight = right * sdlCanvas.getClientUnitWidth();
	float newBottom = bottom * sdlCanvas.getClientUnitHeight();
	float newTop = top * sdlCanvas.getClientUnitHeight();

    glBindTexture(GL_TEXTURE_2D, texture);
    glBegin(GL_QUADS);
	glTexCoord2f(1.0f, 0.375f);
    glVertex3f(newRight, newTop, 0.0f);

	glTexCoord2f(0.0f, 0.375f);
    glVertex3f(newLeft, newTop, 0.0f);

	glTexCoord2f(0.0f, 0.625f);
    glVertex3f(newLeft, newBottom, 0.0f);

	glTexCoord2f(1.0f, 0.625f);
    glVertex3f(newRight, newBottom, 0.0f);
    glEnd();
    glBindTexture(GL_TEXTURE_2D, oldTexture);
}

/*private*/ GLSceneInterfaceDrawers::GLSceneInterfaceDrawers()
{
}

}
